package com.venutech.gongan.dto.rpc.common;

public enum ApiBusinessCode {

    SUCCESS("0000", "操作成功"),
    AUTH_FAILURE("0001", "身份验证失败"),
    NO_PRIVILEGE("0002", "没有访问权限"),
    USER_LOCKED("0003", "用户已被锁定"),
    CLIENT_ERROR("0004", "客户端错误"),
    SERVER_ERROR("0005", "服务器端错误");

    private String code;
    private String msg;

    ApiBusinessCode(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }


    public String getCode() {
        return code;
    }


    public String getMsg() {
        return msg;
    }

    public static String getDescByCode(String code) {
        for (ApiBusinessCode e : ApiBusinessCode.values()) {
            if (e.getCode().equals(code)) {
                return e.getMsg();
            }
        }
        return null;
    }

}
